#include<iostream>
using namespace std;

class Vector
{
private:
	int *cotent;
	int length;
	int count;
public:
	Vector()
	{
		cotent[20] = { 0 };
	}
	Vector(int *arr, int length, int count)
	{
		this->cotent = arr;
		this->length = length;  
		this->count = count;
	}
	void shift_right(int k)
	{
		int t[1] = { 0 };
		int tmp = 0;

		for (int i = 0; i < k; i++)
		{
			tmp = this->cotent[count - 1];
			for (int loc = count - 1; loc > 0; loc--)
			{
				cotent[loc] = cotent[loc - 1];
			}
			cotent[0] = tmp;
		}
	}
	void inverse()
	{
		int tmp;
		for (int i = 0; i < count / 2; i++)
		{
			tmp = cotent[i];
			cotent[i] = cotent[count - 1 - i];
			cotent[count - 1 - i] = tmp;
		}
	}

	bool insert(int newelenment)
	{
		int loc = count - 1;
		if (count >= length)
		{
			return false;
		}
		for (; loc >= 0; loc--)
		{
			if (cotent[loc] > newelenment)
			{
				cotent[loc + 1] = cotent[loc];
			}
			else
			{
				cotent[loc + 1] = newelenment;
				count++;
				break;
			}
		}
		if (loc == -1)
		{
			cotent[0] = newelenment;
			count++;
		}
		return true;
	}
	void output()
	{
		for (int i = 0; i < 20; i++)
		{
			cout << cotent[i]<<" " ;
		}
		cout << endl;
	}
};
int main()
{
	int arr[20] = { 12,23,45,48,49,78,102 };
	Vector * myV = new Vector(arr, 20, 7);
	myV->insert(42);
	myV->output();
	myV->shift_right(5);
	myV->output();
	myV->inverse();
	myV->output();
	return 0;
}